#ifndef SPACE2D_H
#define SPACE2D_H

#include <QWidget>
#include <QPainter>
#include <QPen>
#include <QList>
#include <QMouseEvent>
#include "Drawing.h"

class Space2D : public QWidget
{
    Q_OBJECT

    public:
        explicit Space2D(QWidget *parent = 0);
        ~Space2D();
        void addDraw(Drawing*);
        void addDraws(QList<Drawing*>);
        void cleanAll();
        int numControlPoints();
        void setNumControlPoints(int);
        int initialNumControlPoints();
        void setInitialNumControlPoints(int);
        Drawing* lastDraw();
        void setLastDraw(Drawing*);
        QImage* lastSelectedTexture();
        void setLastSelectedTexture(QImage*);
    protected:
        virtual void paintEvent (QPaintEvent*);
        void mouseReleaseEvent (QMouseEvent*);
        void mousePressEvent (QMouseEvent*);
    private:
        QList<Drawing*> draws;
        QImage* m_lastSelectedTexture;
        //Draw control...
        QPainter* painter;
        QPen* pen;
        int m_initialNumControlPoints;
        int m_NumControlPoints;
        Drawing* m_LastDraw;
        QList<QPoint*> m_LastVertexs;
        //Mouse click control...
        QPoint m_lastAddPoint;
        QPoint m_lastRemovePoint;
        bool m_LeftMouseClick;
        bool m_RightMouseClick;
};

#endif // SPACE2D_H
